<div ng-init="init();" class="kmi-layout-content E07-content">
    <div class="kmi-header-row">
        <div class="kmi-side-btn left" ng-click="back();">
            <i class="material-icons">&#xE408;</i>
            <div class="kmi-can-click"></div>
        </div>
        <div class="brand-title">
            <div class="custom" ng-if="companyName">
                <div class="title" ng-bind="companyName"></div>
                <img src="" alt="" class="brand">
                <div class="gap"></div>
            </div>
            <div class="digiwin">
                <img src="image/smes_v340/logo_ch.png" alt="">
                <img src="image/smes_v340/logo_en.png" alt="">
            </div>
        </div>
        <div class="header-title" ng-bind="'E07.title' | translate:mode"></div>
        <div class="header-logo"></div>
    </div>
    <div class="kmi-layout-main-content">
        <div class="kmi-layout-page">
            <div class="kmi-text-fields">
                <label class="label" style="flex: 0 0 100px;" ng-bind="'E07.pcs_no' | translate"></label>
                <input class="value" ng-model="condition.pcs_no"></input>
                <!-- modify by chenshibo #102223: ��Ŵ���������������û�� -->
                <div class="tip qrcode" ng-click="qrcode_pcs();">
                    <img src="image/icons/QRCode.png">
                </div>
                <label class="label" style="flex: 0 0 100px;" ng-bind="'E07.unit_no' | translate"></label>
                <input class="value" ng-model="condition.unit_no"></input>
                <!-- modify by chenshibo #102223: ��Ŵ���������������û�� -->
                <div class="tip qrcode" ng-click="qrcode_unit();">
                    <img src="image/icons/QRCode.png">
                </div>
                <div class="kmi-button kmi-button-confrim btn-confirm" ng-click="search()" style="width:100px">
                    <label ng-bind="'common.btn.search' | translate"></label>
                    <div class="kmi-can-click"></div>
                </div>
            </div>
            <div class="kmi-text-fields" style="padding-right: 108px;">
                <label class="label" style="flex: 0 0 100px;" ng-bind="'E07.reason_no' | translate"></label>
                <input class="value" ng-model="condition.reason_no"></input>
                <div class="tip search" ng-click="loadReason();"><img src="image/icons/search.png"></img> </div>
                <label class="label" style="flex: 0 0 100px;" ng-bind="'E07.line_no' | translate"></label>
                <input class="value" ng-model="condition.line_no"></input>
                <div class="tip search" ng-click="loadLine();"><img src="image/icons/search.png"></img> </div>
            </div>
            <div class="kmi-text-fields">
                <label class="label" style="flex: 0 0 100px;" ng-bind="'E07.op_no' | translate"></label>
                <input class="value" ng-model="condition.op_no"></input>
                <div class="tip search" ng-click="loadOP();"><img src="image/icons/search.png"></img> </div>
                <label class="label" style="flex: 0 0 100px;" ng-bind="'E07.machine_no' | translate"></label>
                <input class="value" ng-model="condition.machine_no"></input>
                <label class="label" style="flex: 0 0 74px;" ng-bind="'E07.seq_no' | translate"></label>
                <input class="value" style="flex: 0 0 34px;" mdl-calculater="condition.subop_seq" enable-empty="true"></input>
            </div>
            <div class="kmi-list column-selector" column-selector-id="itemList">
                <div class="kmi-list__header">
                    <div class="kmi-list__column require" style="flex:0 0 36px;" ng-show="handle_type != 1"></div>
                    <div class="kmi-list__column require" style="flex:1;" ng-bind="'E07.list.column9' | translate" ng-show="handle_type == 3"></div>
                    <div class="kmi-list__column require" style="flex:1;" ng-bind="'E07.list.column1' | translate"></div>
                    <div class="kmi-list__column require" style="flex:1;" ng-bind="'E07.list.column2' | translate"></div>
                    <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.list.column3' | translate"></div>
                    <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.list.column4' | translate"></div>
                    <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.list.column5' | translate"></div>
                    <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.list.column6' | translate"></div>
                    <div class="kmi-list__column" style="flex:0 0 64px;" ng-bind="'E07.list.column7' | translate"></div>
                    <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.list.column10' | translate"></div>
                    <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.list.column8' | translate"></div>
                </div>
                <div class="kmi-list__row-content">
                <div class="kmi-list__row" ng-repeat="item in itemList track by $index" ng-class="{'is-select':item.master_sid == now_item.master_sid}">
                    <div class="kmi-list__column" style="flex:0 0 36px;z-index:1;" ng-show="handle_type != 1">
                        <button class="mdl-button mdl-js-button mdl-button--icon" ng-click="checkItem(item);">
                            <img ng-hide="item.slected" src="image/icons/check0.png"></img>
                            <img ng-show="item.slected"  src="image/icons/check1.png"></img>
                        </button>
                    </div>
                    <!-- 20231225 modify by Alan for M#154567 - 列表輸入控件要加上z-index:1 -->
                    <div class="kmi-list__column column-input" style="flex:1; z-index: 1;" ng-show="handle_type == 3">
                        <input ng-model="item.scrapped_reason_name" readonly="readonly" ng-click="loadHandleReason(item);"></input>
                        <div class="tip"><i class="material-icons">&#xE5CF;</i></div>
                    </div>
                    <div class="kmi-list__column column-border" style="flex:1;" ng-bind="item.plot_no"></div>
                    <div class="kmi-list__column column-border" style="flex:1;" ng-bind="item.pcs_no"></div>
                    <div class="kmi-list__column column-border" style="flex:1;" ng-bind="item.product_no"></div>
                    <div class="kmi-list__column column-border" style="flex:1;" ng-bind="item.product_name"></div>
                    <div class="kmi-list__column column-border" style="flex:1;" ng-bind="item.pdline_no"></div>
                    <div class="kmi-list__column column-border" style="flex:1;" ng-bind="item.op_no"></div>
                    <div class="kmi-list__column column-border" style="flex:0 0 64px;" ng-bind="item.sub_opsequence"></div>
                    <div class="kmi-list__column column-border" style="flex:1;" ng-bind="item.machine_no"></div>
                    <div class="kmi-list__column column-input bdreason" style="flex:1;">
                        <input class="value" style="flex: 1;" ng-model="item.reason_desc" readonly="readonly" ></input>
                        <!-- 20220929 modify by Alan for M#116888 - 修正.kmi-list__column內.tip.search 會觸發home()的問題-->
                        <div class="new-search" ng-click="loadBdreason(item);" style="z-index: 1;">
                            <img src="image/icons/search.png"></img> 
                        </div>
                    </div>
                    <div class="kmi-can-click" ng-click="selectItem(item);"></div>
                </div>
                </div>
            </div>
            <div class="setting-content">
                <div class="kmi-list" column-selector-id="sub_list">
                    <div class="kmi-list__header">
                        <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.sub_list.column1' | translate"></div>
                        <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.sub_list.column2' | translate"></div>
                        <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.sub_list.column3' | translate"></div>
                    </div>
                    <div class="kmi-list__row-content">
                    <div class="kmi-list__row" ng-repeat="item in subItemList track by $index">
                        <div class="kmi-list__column column-border" style="flex:1;" ng-bind="item.material_type"></div>
                        <div class="kmi-list__column column-border" style="flex:1;" ng-bind="item.unit_name"></div>
                        <div class="kmi-list__column" style="flex:1;" ng-bind="item.unit_no"></div>
                    </div>
                    </div>
                </div>
                <div  class="handler-content" ng-class="[getHandleType()]">
                    <div class="kmi-text-fields">
                        <label class="label" ng-bind="'E07.pcs_handler' | translate"></label>
                        <button class="mdl-button mdl-js-button kmi-checkbox" ng-click="setHandleType('2')">
                            <img ng-src="{{handle_type == '2'?'image/icons/check1.png':'image/icons/check0.png'}}"></img>
                            {{'E07.fix' | translate}}
                        </button>
                        <button class="mdl-button mdl-js-button kmi-checkbox" ng-click="setHandleType('1')">
                            <img ng-src="{{handle_type == '1'?'image/icons/check1.png':'image/icons/check0.png'}}"></img>
                            {{'E07.replace' | translate}}
                        </button>
                        <button class="mdl-button mdl-js-button kmi-checkbox" ng-click="setHandleType('3')">
                            <img ng-src="{{handle_type == '3'?'image/icons/check1.png':'image/icons/check0.png'}}"></img>
                            {{'E07.scrapped' | translate}}
                        </button>
                        <button class="mdl-button mdl-js-button kmi-checkbox" ng-click="setHandleType('4')">
                            <img ng-src="{{handle_type == '4'?'image/icons/check1.png':'image/icons/check0.png'}}"></img>
                            {{'E07.single_fix' | translate}}
                        </button>
                    </div>
                    <div class="kmi-text-fields fix-replace">
                        <button class="mdl-button mdl-js-button kmi-checkbox" ng-click="auto_next = '1'">
                            <img ng-src="{{auto_next == '1'?'image/icons/check1.png':'image/icons/check0.png'}}"></img>
                            {{'E07.auto_next' | translate}}
                        </button>
                        <button class="mdl-button mdl-js-button kmi-checkbox" ng-click="auto_next = '2'">
                            <img ng-src="{{auto_next == '2'?'image/icons/check1.png':'image/icons/check0.png'}}"></img>
                            {{'E07.nonauto_next' | translate}}
                        </button>
                    </div>
                    <div class="kmi-text-fields single-fix">
                        <label class="label" ng-bind="'E07.unbinding_process' | translate"></label>
                    </div>
                    <div class="kmi-list single-fix">
                        <div class="kmi-list__header">
                            <!-- 20230313 modify by Alan for M#129881: -->
                            <div class="kmi-list__column width-fixed" style="flex:0 0 36px; z-index:1;">
                                <button class="mdl-button mdl-js-button mdl-button--icon" ng-click="selectAllSubOpSeq();">
                                    <img ng-hide="isSelectAll" src="image/icons/check0.png"></img>
                                    <img ng-show="isSelectAll" src="image/icons/check1.png"></img>
                                </button>
                            </div>
                            <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.unbinding_list.column1' | translate"></div>
                            <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.unbinding_list.column2' | translate"></div>
                            <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.unbinding_list.column3' | translate"></div>
                            <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.unbinding_list.column4' | translate"></div>
                        </div>
                        <div class="kmi-list__row-content">
                            <div class="kmi-list__row" ng-repeat="item in now_item.detail_list track by $index">
                                <div class="kmi-list__column" style="flex:0 0 36px; z-index:1;">
                                    <button class="mdl-button mdl-js-button mdl-button--icon" ng-click="selectSubOpSeq(item);">
                                        <img ng-hide="item.isSelect" src="image/icons/check0.png"></img>
                                        <img ng-show="item.isSelect"  src="image/icons/check1.png"></img>
                                    </button>
                                </div>
                                <div class="kmi-list__column column-border" style="flex:1;" ng-bind="item.sub_op_seq"></div>
                                <div class="kmi-list__column column-border" style="flex:1;" ng-bind="item.position_no"></div>
                                <div class="kmi-list__column column-border" style="flex:1;" ng-bind="item.unit_name"></div>
                                <div class="kmi-list__column column-border" style="flex:1;" ng-bind="item.material_unit_no"></div>
                            </div>
                        </div>
                    </div>
                    <div class="kmi-text-fields replace">
                        <label class="label" style="flex: 0 0 58px;" ng-bind="'E07.old_seq_no' | translate"></label>
                        <input class="value" ng-model="handleData.old_seq_no" ng-keypress="handleBarcode($event);"></input>
                        <div class="tip qrcode" ng-click="handleQrcode(handleData.old_seq_no);">
                            <img src="image/icons/QRCode.png">
                        </div>
                        <label class="label" style="flex: 0 0 58px;" ng-bind="'E07.new_seq_no' | translate"></label>
                        <input class="value" ng-model="handleData.new_seq_no" ng-keypress="handleBarcode($event);"></input>
                        <div class="tip qrcode" ng-click="handleQrcode(handleData.new_seq_no);">
                            <img src="image/icons/QRCode.png">
                        </div>
                        <button class="mdl-button mdl-js-button mdl-button--icon mdl-button--icon_prime" ng-click="addSeqno();">
                            <img src="image/icons/add.png"></img>
                        </button>
                    </div>
                    <div class="kmi-list replace" column-selector-id="seq_list">
                        <div class="kmi-list__header">
                            <div class="kmi-list__column" style="flex:0 0 36px;"></div>
                            <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.seq_list.column1' | translate"></div>
                            <div class="kmi-list__column" style="flex:1;" ng-bind="'E07.seq_list.column2' | translate"></div>
                        </div>
                        <div class="kmi-list__row-content">
                        <div class="kmi-list__row" ng-repeat="item in handleData.seq_list track by $index">
                            <div class="kmi-list__column" style="flex:0 0 36px;">
                                <button class="mdl-button mdl-js-button mdl-button--icon" ng-click="RemoveSeqno(item)">
                                    <img  src="image/icons/delete.png"></img>
                                </button>
                            </div>
                            <div class="kmi-list__column column-border" style="flex:1;" ng-bind="item.old_seq_no"></div>
                            <div class="kmi-list__column" style="flex:1;" ng-bind="item.new_seq_no"></div>
                        </div>
                        </div>
                    </div>
                    <div class="kmi-text-fields" style="position: absolute;bottom: 8px;right: 16px;">
                        <div class="kmi-button kmi-button-confrim handle_log" ng-click="handleLog();" style="width:100px">
                            <label ng-bind="'E07.handle_log' | translate"></label>
                            <div class="kmi-can-click"></div>
                        </div>
                        <div class="kmi-button kmi-button-confrim" ng-click="confirm();" style="width:100px">
                            <label ng-bind="'E07.handle' | translate"></label>
                            <div class="kmi-can-click"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
